
#include<iostream>
#include<stack>
#include<queue>
#include<vector>
#include<string>
#include<ctime>
#include<algorithm>
#include<queue>
#include "myStack.h"
#include "myHeap.h"
#include "sort.h"
using namespace std;


class Solution {
public:
    void _func(string& digit, string* mirror, size_t size, size_t pos, vector<string>& ret, string& tmp)
    {
        if (pos >= size)
        {
            ret.push_back(tmp);
            tmp = "";
            return;
        }
        string st = mirror[digit[pos] - '0'];
        for (auto au : st)
        {
            tmp += au;
            _func(digit, mirror, size, pos + 1, ret, tmp);
        }
    }
    vector<string> letterCombinations(string digits) {
        string mirror[10] = { "","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz" };
        size_t size = digits.size();
        vector<string> ret;
        string tmp;
        _func(digits, mirror, size, 0, ret, tmp);
        return ret;
    }
};

namespace linhui
{
    void test_myStack()
    {
        stack<char> st;
        st.push('d');
        st.push('q');
        st.push('e');
        st.push('r');
        st.push('f');
        st.push('l');
        while (!st.empty())
        {
            cout << st.top() << " ";
            st.pop();
        }
        cout << endl;

        queue<char> qu;
        qu.push('d');
        qu.push('q');
        qu.push('e');
        qu.push('r');
        qu.push('f');
        qu.push('l');
        while (!qu.empty())
        {
            cout << qu.top() << " ";
            qu.pop();
        }
    }
    void test_priorityQueue()
    {
       /* priority_queue<int,vector<int>,less<int>> pr;
        pr.push(6);
        pr.push(0);
        pr.push(456);
        pr.push(1);
        pr.push(3);
        pr.push(56);
        pr.push(5);
        while (!pr.empty())
        {
            cout << pr.top() << " ";
            pr.pop();
        }*/
    }
    void test_myHeap()
    {
        heap<int> hp;
        hp.push_back(9);
        hp.push_back(3);
        hp.push_back(9);
        hp.push_back(4);
        hp.push_back(3);
        hp.push_back(7);
        hp.push_back(1);
        printContainer(hp);
        hp.pop_front();
        hp.pop_front();
        hp.pop_front();
        hp.pop_front();
        printContainer(hp);

        hp.heap_sort();
        printContainer(hp);
    }
    void test_heapSort_pace()
    {
        srand(time(0));
        heap<int> hp;
        int num = 100000000;
        hp.reserve(100000000);
        while (num--)
        {
            hp.push_back(rand());
        }
        int begin = clock();
        hp.heap_sort();
        int end = clock();
        cout << end - begin;
    }
    void test_mimicFunction()
    {
        heap<int, vector<int>> hp;
        //heap<int,vector<int>,greater<int>> hp;
        hp.push_back(9);
        hp.push_back(3);
        hp.push_back(9);
        hp.push_back(4);
        hp.push_back(3);
        hp.push_back(7);
        hp.push_back(1);

        hp.heap_sort(less<int>());
        printContainer(hp);
    }
    //void test_MergeSort()
    //{
    //    //int arr[] = { 4,6,3,2,1,7,8,9,5,4,2,1,4,5,2 };
    //    //int arr[] = { 6,-3,0 ,4,-6 };
    //    int arr[] = { 33,33,22,22,1,1,5,9,100,600 };
    //    //int arr[] = { 4,6,3,2};
    //    MergeSort(arr, sizeof(arr) / sizeof(arr[4]), less<int>());
    //    for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++)
    //    {
    //        cout << arr[i] << " ";
    //    }
    //    cout << endl;
    //   /* MergeSort(arr, sizeof(arr) / sizeof(arr[4]), greater<int>());
    //    for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++)
    //    {
    //        cout << arr[i] << " ";
    //    }*/
    //}
}
int main()
{
    //linhui::test_MergeSort();
    //PrepareForMerge();

    linhui::test_mimicFunction();
    // 
    //linhui::test_heapSort_pace();
    /*cout << "hello world" << endl;
    cout << (0-1)/2 <<endl;
    linhui::test_myHeap();*/
    //linhui::test_priorityQueue();
    //linhui::test_myStack();
    //Solution().letterCombinations("23");
	return 0;
}